package fz.vrd.library.adapter;


import android.view.View;
import android.view.ViewGroup;

import androidx.viewpager.widget.PagerAdapter;

import java.util.ArrayList;
import java.util.List;


public class BaseViewPageAdapter extends PagerAdapter {

    List<View> listView = new ArrayList<View>();

    public BaseViewPageAdapter(List<View> listView) {
        this.listView = listView;
    }

    @Override
    public int getCount() {

        return listView == null ? 0 : listView.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {

        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(listView.get(position));
        return listView.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(listView.get(position));
    }

}
